import Vue from 'vue';
import Router from 'vue-router';

Vue.use(Router);

const routes = [
    {
        path: '/',
        name: 'Layout',
        component: () => import('@/layout/index'),
        redirect: '/dashboard',
        children: [
            {
                path: 'dashboard',
                name: 'Dashboard',
                component: ()=>import('@/views/Dashboard.vue'),
                meta: {title: '首页'}
            },
            {
                path: 'profile',
                name: 'Profile',
                component: ()=>import('@/views/Profile.vue'),
                meta: {title: '个人中心'}
            },
        ]
    },
    {
        path: '/system',
        name: 'System',
        component: () => import('@/layout/index'),
        meta:{title:'系统管理'},
        children: [
            {
                path: 'user',
                name: 'User',
                component: ()=>import('@/views/system/User.vue'),
                meta: {title: '用户管理'}
            },
            {
                path: 'unit',
                name: 'Unit',
                component: ()=>import('@/views/system/Unit.vue'),
                meta: {title: '单元管理'}
            },
            {
                path: 'payment',
                name: 'Payment',
                component: ()=>import('@/views/system/Payment.vue'),
                meta: {title: '缴费管理'}
            },
            {
                path: '/system/helpManage',
                name: 'HelpManage',
                component: {render(c){return c('router-view')}},
                redirect: '/system/helpManage',
                meta: {title: '求助管理'},
                children: [
                    {
                        path: 'help',
                        name: 'Help',
                        component: ()=>import('@/views/system/Help.vue'),
                        meta: {title: '在线求助管理'}
                    },
                    {
                        path: 'remark',
                        name: 'Remark',
                        component: ()=>import('@/views/system/Remark.vue'),
                        meta: {title: '互助评论管理'}
                    },
                ]
            },
            {
                path: '/system/newsManage',
                name: 'NewsManage',
                component: {render(c){return c('router-view')}},
                redirect: '/system/newsManage',
                meta: {title: '新闻管理'},
                children: [
                    {
                        path: 'news',
                        name: 'News',
                        component: ()=>import('@/views/system/News.vue'),
                        meta: {title: '新闻公告管理'}
                    },
                    {
                        path: 'respond',
                        name: 'Respond',
                        component: ()=>import('@/views/system/Respond.vue'),
                        meta: {title: '新闻响应管理'}
                    },
                ]
            },
            
        ]
    },
    {
        path: '/log',
        name: 'Log',
        component: () => import('@/layout/index'),
        meta:{title:'日志记录'},
        children: [
            {
                path: 'loginlog',
                name: 'LoginLog',
                component: ()=>import('@/views/log/LoginLog.vue'),
                meta: {title: '后台登录日志'}
            },
            {
                path: 'operatelog',
                name: 'OperateLog',
                component: ()=>import('@/views/log/OperateLog.vue'),
                meta: {title: '后台操作日志'}
            },
            {
                path: 'deallog',
                name: 'DealLog',
                component: ()=>import('@/views/log/DealLog.vue'),
                meta: {title: '用户交易记录'}
            },
        ]
    },
    {
        path:'/login',
        name:'Login',
        component:()=>import('@/views/Login.vue'),
    }
];


export default new Router({
    mode: 'history', 
    routes: routes
})